<?php /* SVN: $Id: admin_edit.ctp 2894 2010-09-02 10:01:36Z sakthivel_135at10 $ */ ?>
<div class="projects form">
<?php echo $this->Form->create('Project', array('class' => 'normal clearfix','enctype' => 'multipart/form-data'));
?>
	<?php echo $this->Form->input('id');?>
	<div class="admin-project-details project-form-content">
		<fieldset  class="fields-block round-5">
			<h3><?php echo __l('Project details'); ?></h3>
			<?php
				echo $this->Form->input('name');
				echo $this->Form->input('short_description', array('type'=>'textarea','label'=>__l('Short description'),'info'=>__l('Entered description will display in home and listing pages')));
				echo $this->Form->input('description', array('type'=>'textarea', 'class' => 'js-editor', 'label'=>__l('Description'),'info'=>__l('Entered description will display in view page')));
				echo $this->Form->input('project_category_id', array('empty' => __l('Please select'),'label'=>__l('Project category')));
			?>
			<div class="upload-image">
				<?php echo $this->Form->input('Attachment.filename', array('type' => 'file','size' => '33', 'label' => __l('Project image'),'info'=>__l('Maximum allowed size ').Configure::read('project.image.allowedSize').Configure::read('project.image.allowedSizeUnits'), 'class' =>'browse-field')); ?>
			</div>
			<?php
				echo $this->Form->input('video_embed_code',array('label'=>__l('Video embed code')));
			?>
		</fieldset>
	</div>
	<div class="admin-project-details project-form-content">
		<fieldset class="fields-block round-5">
			<h3><?php echo __l('Fund Details'); ?></h3>
			 <?php
				if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending || (Configure::read('Project.is_allow_project_owner_to_edit_amount_in_open_status') && $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding)):
					echo $this->Form->input('needed_amount', array('label'=>__l('Needed amount').' ('.Configure::read('site.currency').')'));
				else:
				?>
					<dl>
						<dt><?php echo __l('Amount').':' ?></dt>
						<dd><?php echo Configure::read('site.currency').$this->request->data['Project']['needed_amount'];?></dd>
					</dl>
				<?php
						echo $this->Form->input('needed_amount', array('type'=>'hidden'));
				endif;
			?>
			<?php if (Configure::read('Project.is_allow_extend_funding_end_date')) :
				if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending){
					$start_date = __l('today');
					$expiry_date=time();
				}else{
					echo $this->Form->input('project_funding_start_date', array('type' => 'hidden'));
					$start_date =$this->Html->cDate($this->request->data['Project']['project_funding_start_date']);
 					$expiry_date=strtotime($this->request->data['Project']['project_funding_start_date']);
				}
			?>
			<div class="input date">
				<div class="js-datetime">
					<?php echo $this->Form->input('project_funding_end_date', array('type' => 'date', 'div' => false,'label'=>__l('Project funding end date'), 'orderYear' => 'asc')); ?>
				</div>
				<span class="info"><?php echo __l('Ending date should be within ') .Configure::read('Project.paypal_expiry_date'). __l(' days from project starting date').' '.$start_date .' . '.__l('Because paypal authorization will expire in ').Configure::read('Project.paypal_expiry_date'). __l(' days'); ?></span>
			</div>
			<?php endif;?>

				<?php
				if (Configure::read('Project.is_allow_over_funding')) :
						echo $this->Form->input('is_allow_over_funding',array('label'=>__l('Allow 0verfunding')));
				endif;
			?>
		</fieldset>
	</div>
	<?php if(Configure::read('Project.is_enable_project_rewards') || !empty($this->request->data['ProjectReward']) ): ?>
	<div class="admin-project-details project-form-content">
		<fieldset  class="fields-block round-5">
			<h3><?php echo __l('Reward details'); ?></h3>
			<?php
					$class = '';
					if(Configure::read('Project.is_project_reward_optional')):
						$class = "not-required";
					endif;
				?>
			<div class="js-clone <?php echo $class; ?> ">
				<div class="clearfix add-block"><span class ="js-add-more clone-add">Add more</span></div>
			<?php if(empty($this->request->data['ProjectReward'])):?>
					<div class="website-block js-field-list">
						<?php
								echo $this->Form->input('ProjectReward.0.pledge_amount',array('label'=>__l('Pledge amount').' ('.Configure::read('site.currency').')','info'=>__l('Reward amount')));
								echo $this->Form->input('ProjectReward.0.reward',array('info'=>__l('Reward details')));
								echo $this->Form->input('ProjectReward.0.pledge_max_user_limit',array('label'=>__l('Pledge max user limit'),'info'=>__l('Maximum user allowed for this reward. Leave blank for no limit.')));
						?>
					</div>
				<?php else:	?>
						<?php 	foreach($this->request->data['ProjectReward'] as $key => $projectReward) :?>
							<div class="phone-block website js-field-list">
							<?php if($key):?>
								<span class="js-website-remove clone-remove"><?php echo __l('Remove'); ?></span>
							<?php endif;?>
							<?php
								echo $this->Form->input('ProjectReward.'.$key.'.pledge_amount',array('label'=>__l('Pledge amount').' ('.Configure::read('site.currency').')','info'=>__l('Reward amount')));
								echo $this->Form->input('ProjectReward.'.$key.'.reward',array('info'=>__l('Reward details')));
								echo $this->Form->input('ProjectReward.'.$key.'.pledge_max_user_limit',array('label'=>__l('Pledge max user limit'),'info'=>__l('Maximum user allowed for this reward. Leave blank for no limit.')));
							?>
							</div>
						<?php endforeach;?>
				<?php endif;?>
			</div>
		</fieldset>
	</div>
	<?php endif;?>
	<div class="admin-project-details project-form-content">
		<fieldset class="fields-block round-5">
			<h3><?php echo __l('Admin actions'); ?></h3>
			<div class="disk-usage clearfix">
			<?php
				echo $this->Form->input('project_status_id', array('empty' => __l('Please select'),'label'=>__l('Project status')));
				echo $this->Form->input('is_active',array('label'=>__l('Active')));
				echo $this->Form->input('is_recommended',array('label'=>__l('Recommended')));
			?>
			</div>
		</fieldset>
	</div>
<div class="submit-block clearfix">
<?php
	echo $this->Form->submit(__l('Update'));
?>
<div class="cancel-block">
<?php
	echo $this->Html->link(__l('Cancel'), array('controller' => 'projects', 'action' => 'index'),array('title' => __l('Cancel')));
?>
</div>
</div>
<?php echo $this->Form->end();?>
</div>